Title: Soft Reset
Author: SilentEnigma
Version: 1.1
Release Date: 2021-10-24
Applies to: Final Fantasy III (v1.0) (U)

Archive Contents:

    SoftReset_H.ips = the full patch for headered ROMs

    SoftReset_NH.ips = the full patch for unheadered ROMs

    readme.txt = this file


ROM Addresses:

    C0/C504 - C0/C505
    C3/A527 - C3/A529


Free space used:

    C0/D720 - C0/D72B (12 bytes)
    C3/FB28 - C3/FB7C (55 bytes)

NOTE: 

    This mod shares code with the author's "Optional Continue" patch v1.1.

________________________________________________________________________________

TABLE OF CONTENTS

0. Description
1. Relevant Offsets & Disassembly
2. Revision History
3. Credits
4. Legal
________________________________________________________________________________

  0. DESCRIPTION
________________________________________________________________________________


This patch adds the a soft reset command to FF3/6 SNES.

The player may trigger a soft reset by pressing Start+Select+L+R from the
field and during battle.

Patches for both headered and non-headered ROMs are included.

________________________________________________________________________________

  1. RELEVANT OFFSETS & DISASSEMBLY
________________________________________________________________________________


Soft Reset via Start+Select+R+L


Original:
 C3/A527: AC 13 02    LDY $0213  ; start of prep for long return after joypad decode function
Modified:
 C3/A527: 20 28 FB    JSR $FB28  ; Jump to new subroutine C3/FB28

New Subroutine C0/D720 (Provide long access to C0/0525):
 C0/D720: 20 25 05    JSR 0525 
 C0/D723: 6B          RTL

New Subroutine C0/D724 (Provide long access to C0/0573):
 C0/D724: 20 73 05    JSR 0573 
 C0/D727: 6B          RTL

New Subroutine C3/FB28 (Check for Soft Reset command & do Soft Reset):
 C3/FB28: 08          PHP           ; Push status register
 C3/FB29: A9 C3       LDA #C3       ; Disable soft reset for this bank (menus)
 C3/FB2B: C3 06       CMP $06,S     ; Bank of C3/A527's calling function
 C3/FB2D: F0 09       BEQ $FB38     ; Branch if equal
 C3/FB2F: C2 20       REP #$20      ; 16-bit Accumulator
 C3/FB31: A5 04       LDA $04       ; mapped controller
 C3/FB33: 49 30 30    EOR $#3030    ; Is Start+Select+L+R pressed?
 C3/FB36: F0 05       BEQ $FB3D     ; Branch if so
 C3/FB38: 28          PLP           ; Pull status register
 C3/FB39: AC 13 02    LDY $0213     ; originally at C3/A527
 C3/FB3C: 60          RTS
 C3/FB3D: E2 24       SEP #24       ; Reset state as when executing C0/0020
 C3/FB3F: A9 F0       LDA #F0       ; SPC interrupt "Stop song & sound effect"
 C3/FB41: 8D 00 13    STA $1300     ; SPC command byte 0
 C3/FB44: 22 04 00 C5 JSL $C50004   ; Execute SPC command 
 C3/FB48: A2 FF 15    LDX #$15FF
 C3/FB4B: 9A          TXS           ; (made the stack point to $15FF)
 C3/FB4C: A2 00 00    LDX #$0000
 C3/FB4F: DA          PHX 
 C3/FB50: 2B          PLD           ; (made the direct page reg. hold #$0000)
 C3/FB51: 7B          TDC 
 C3/FB52: 48          PHA 
 C3/FB53: AB          PLB           ; (made the data bank reg. hold #$00)
 C3/FB54: A9 01       LDA #$01
 C3/FB56: 8D 0D 42    STA $420D     ; (Disable SlowROM???)
 C3/FB59: 9C 0B 42    STZ $420B
 C3/FB5C: 9C 0C 42    STZ $420C
 C3/FB5F: A9 8F       LDA #$8F
 C3/FB61: 8D 00 21    STA $2100
 C3/FB64: 9C 00 42    STZ $4200
 C3/FB67: 22 20 D7 C0 JSL $C0D720   ; Jump long to new subroutine C0/D720
 C3/FB6B: A2 00 00    LDX #$0000
 C3/FB6E: 86 00       STX $00
 C3/FB70: A2 FF FF    LDX #$FFFF
 C3/FB73: 86 02       STX $02
 C3/FB75: 22 24 D7 C0 JSL $C0D724   ; Jump long to new subroutine C0/D724
 C3/FB79: 5C 53 00 C0 JML $C00053   ; Continue with initialization,
                                    ;   skipping sound chip init. ($C0/004F)

----------------------------------------

Prevent a sound bug introduced by some emulators after the party is defeated in
an unsaved game

Original:
 C0/C503: 4C 00 FF   JMP $FF00  ; Jump to entry point
Modified:
 C0/C503: 4C 28 D7   JMP $D728  ; Jump to new subroutine C0/D728
 
New Subroutine C0/D728 (Jump straight to soft reset):
 C0/D728: 5C 3D FB C3 JML $C3FB3D

________________________________________________________________________________

  2. CREDITS
________________________________________________________________________________


Imzogelmo - Disassembly of banks C0 & C3
http://www.angelfire.com/al2/imzogelmo/patches.html#disassembly

________________________________________________________________________________

  3. REVISION HISTORY
________________________________________________________________________________


2020-05-16 : Version 1.0 released.

2021-10-24 : Version 1.1 released.
 - Now compatible with Madsiur's 'FF6 Music Player' hack.

________________________________________________________________________________

  4. LEGAL
________________________________________________________________________________

Copyright (C) 2020, 2021 David R. Thompson (SilentEnigma).

The copyright holder ("author") permits the free use of the attributed work
referenced by this document exclusively for non-commercial purposes, provided
that the following conditions are met:
1. The author and all contributors credited in this readme document shall be
 given credit for their respective contributions wherever the attributed work is
 reused, redistributed, or modified.
2. This readme document shall accompany any of the files comprising the
 attributed work wherever they are redistributed in unmodified form.

The work(s) and file(s) distributed with this document are provided "AS-IS",
WITHOUT ANY WARRANTY. The author shall not be held responsible for any damages
related to the use of work(s) and file(s) distributed with this document.
